<template>
	<view class="loginPage">

	</view>
</template>
<script>
	export default {
		data() {
			return {
				phone: '', //手机号码
				password: '', //密码
			};
		},
		methods: {
			//当前登录按钮操作
			userLogin() {
				//验证登录账户
				if (!this.phone) {
					return this.$Toast('请输入您的账号');
				}
				//正则验证
				if (!/^1[3-9]\d{9}$/.test(this.phone)) {
					return this.$Toast('请输入正确的账号')
				}
				if (!this.password) {
					return this.$Toast('请输入您的密码');
				}
				//手机号密码登录
				this.$Api.common.userLogin({
					phone: this.phone,
					password: this.password,
				}).then(res => {
					//提交用户信息到VueX
					this.$store.commit('LOGIN', {
						token: res.data.token
					})
				})
			}
		};
</script>
<style scoped lang="scss">

</style>